{extend name="base/base" /}
{block name="title"}管理员管理{/block}
{block name="content"}
<section class="Hui-article-box">
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 管理员管理 <span
                class="c-gray en">&gt;</span> 管理员列表 <a class="btn btn-success radius r"
                                                       style="line-height:1.6em;margin-top:3px"
                                                       href="javascript:location.replace(location.href);" title="刷新"><i
                    class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="Hui-article">
        <article class="cl pd-20">
            <div class="cl pd-5 bg-1 bk-gray"><span class="l">  <a
                            class="btn btn-primary radius" href="/admin/user/create">
                        <i class="Hui-iconfont">&#xe600;</i> 添加管理员</a> </span>
            </div>
            <div class="mt-10">
                <table class="table table-border table-bordered table-hover table-bg">
                    <thead>
                    <tr>
                        <th scope="col" colspan="6">管理员管理</th>
                    </tr>
                    <tr class="text-c">
                        <th width="40">ID</th>
                        <th width="200">用户名</th>
                        <th width="300">用户角色</th>
                        <th width="70">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="userDatas" id="userData"}
                    <tr class="text-c">
                        <td>{$userData.id}</td>
                        <td>{$userData.username}</td>
                        <td>{:getCurrenAuthGroup($userData.id)}</td>
                        <td>
                            <a title="编辑" href="/admin/user/{$userData.id}/edit"
                               style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> <a
                                    title="删除" href="javascript:;" onclick="deleteuser({$userData.id});return false;"
                                    class="ml-5"
                                    style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
                        </td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
            </div>
            {$userDatas->render()}
        </article>
    </div>
</section>
{/block}
{block name="js"}
<script>
    function deleteuser(id) {
        if (!confirm('确认操作，此操作不可逆?')) {
            return;
        }
        $.ajax({
                type: "DELETE", //提交方式
                url: "/admin/user/" + id,//路径
                dataType: 'Json',
                success: function (res) {
                    if (res.status) {
                        alert(res.msg);
                        location.reload()
                    } else {
                        alert(res.msg);
                    }
                }
            }
        )
    }
</script>
<!--/请在上方写此页面业务相关的脚本-->
{/block}